home *** CD-ROM | disk | FTP | other *** search
/ Take-Home Tutor en Espanol / TakeHomeTutor.iso / pc / En espanol / Take-Home Tutor 3 / template3.swf / scripts / frame_1 / DoAction.as < prev   
Encoding:
Text File  |  2003-09-23  |  55.7 KB  |  2,082 lines

  1. function ext_XML_GET_TEXT()
  2. {
  3.    return this.firstChild.nodeType != 3 ? null : this.firstChild.nodeValue;
  4. }
  5. function ext_XML_SET_TEXT(text)
  6. {
  7.    this.firstChild.nodeValue = text;
  8. }
  9. function ActivityInfoItem()
  10. {
  11. }
  12. function ActivityInfo()
  13. {
  14. }
  15. function createIndexList(str, openTag, closeTag)
  16. {
  17.    var len = str.length;
  18.    var acntr = 0;
  19.    var otag = openTag;
  20.    var ctag = closeTag;
  21.    var abi = [];
  22.    var aei = [];
  23.    while(acntr < len)
  24.    {
  25.       acntr = str.indexOf(otag,acntr);
  26.       if(acntr == -1)
  27.       {
  28.          break;
  29.       }
  30.       abi.push(acntr);
  31.       acntr += otag.length;
  32.    }
  33.    acntr = 0;
  34.    while(acntr < len)
  35.    {
  36.       acntr = str.indexOf(ctag,acntr);
  37.       if(acntr == -1)
  38.       {
  39.          break;
  40.       }
  41.       aei.push(acntr);
  42.       acntr += ctag.length;
  43.    }
  44.    var rf = otag.length + ctag.length;
  45.    var i = 0;
  46.    while(i < abi.length)
  47.    {
  48.       if(i == 0)
  49.       {
  50.          aei[i] -= ctag.length - 1;
  51.       }
  52.       else
  53.       {
  54.          abi[i] -= rf * i;
  55.          aei[i] -= rf * i + otag.length;
  56.       }
  57.       i++;
  58.    }
  59.    return {startIndex:abi,endIndex:aei,length:abi.length};
  60. }
  61. function createInstructionField(cnt, name, text)
  62. {
  63.    text = simpleReplaceBlanks(text,"[:blank:]","[:/blank:]");
  64.    var hasBold = text.indexOf("[:bold:]") != -1;
  65.    if(cnt[name] == null)
  66.    {
  67.       var tmc = cnt.createEmptyMovieClip(name,1667);
  68.       tmc.createTextField("content",1,0,0,0,0);
  69.    }
  70.    else
  71.    {
  72.       var tmc = cnt[name];
  73.       tmc.swapDepths(1667);
  74.    }
  75.    tmc.isRemoveable = true;
  76.    tmc.isRemovable = true;
  77.    var tf = layoutInfo.instTextFormat;
  78.    tmc.content.border = false;
  79.    tmc.content.type = "dynamic";
  80.    if(hasBold)
  81.    {
  82.       tmc.content.text = text.replace("[:bold:]","").replace("[:/bold:]","");
  83.    }
  84.    else
  85.    {
  86.       tmc.content.text = text;
  87.    }
  88.    tmc.content._height = 400;
  89.    tmc.content.wordWrap = true;
  90.    tmc.content.color = layoutInfo.instTextColor;
  91.    tmc.content._width = 300;
  92.    tmc.content.autoSize = true;
  93.    tmc.content.selectable = false;
  94.    tmc.content.setTextFormat(tf);
  95.    tmc.content.embedFonts = true;
  96.    if(hasBold)
  97.    {
  98.       var idxLists = createIndexList(text,"[:bold:]","[:/bold:]");
  99.       var i = 0;
  100.       while(i < idxLists.length)
  101.       {
  102.          tmc.content.setTextFormat(idxLists.startIndex[i],idxLists.endIndex[i],layoutInfo.instTextFormatBold);
  103.          i++;
  104.       }
  105.    }
  106.    return tmc;
  107. }
  108. function changeInstructionField(insField, newText)
  109. {
  110.    createInstructionField(insField._parent,insField._name,newText);
  111. }
  112. function toggleLang()
  113. {
  114.    if(PMSI.instructionLanguage == "Spanish")
  115.    {
  116.       PMSI.instructionLanguage = "English";
  117.    }
  118.    else
  119.    {
  120.       PMSI.instructionLanguage = "Spanish";
  121.    }
  122.    var instText = ai["instructions" + PMSI.instructionLanguage].text;
  123.    if(instText != null)
  124.    {
  125.       var oldInstHeight = this.instructionField._height;
  126.       changeInstructionField(this.instructionField,instText);
  127.       var hdiff = this.instructionField._height - oldInstHeight;
  128.       reposition(hdiff);
  129.    }
  130.    pencilHelper.swapLangs();
  131. }
  132. function reposition(hdiff)
  133. {
  134.    var comp;
  135.    var dupList = {};
  136.    trace("******************************************");
  137.    for(var mcn in this)
  138.    {
  139.       comp = this[mcn];
  140.       if(comp.isMoveable && dupList[comp._name] == null)
  141.       {
  142.          trace("\t" + comp);
  143.          trace("\t\t" + comp.getDepth());
  144.          trace(hdiff);
  145.          comp._y += hdiff;
  146.          dupList[comp._name] = 1;
  147.       }
  148.    }
  149.    trace("******************************************");
  150. }
  151. function simpleReplaceBlanks(str, stag, etag)
  152. {
  153.    var cp = str.indexOf(stag);
  154.    var ei = 0;
  155.    while(cp != -1)
  156.    {
  157.       ei = str.indexOf(etag);
  158.       str = str.substring(0,cp) + "_____" + str.substring(ei + etag.length);
  159.       cp = str.indexOf(stag);
  160.    }
  161.    return str;
  162. }
  163. function loadActivity(fname)
  164. {
  165.    t = getTimer();
  166.    ai.load(fname);
  167. }
  168. function setActivityInfo(_ai)
  169. {
  170.    ai = _ai;
  171.    ai._parent = this;
  172.    render();
  173.    return true;
  174. }
  175. function makeForceNoWrap(line, indexArray)
  176. {
  177.    var si;
  178.    var ei;
  179.    var i = 0;
  180.    while(i < indexArray.length)
  181.    {
  182.       si = indexArray.startIndex[i];
  183.       ei = indexArray.endIndex[i];
  184.       var j = si + 1;
  185.       while(j < ei)
  186.       {
  187.          if(line.charAt(j) == " ")
  188.          {
  189.             line = line.substring(0,j) + "_" + line.substring(j + 1);
  190.          }
  191.          j++;
  192.       }
  193.       i++;
  194.    }
  195.    return line;
  196. }
  197. function removeForceNoWrap(s)
  198. {
  199.    var j = 0;
  200.    while(j < s.length)
  201.    {
  202.       if(s.charAt(j) == "_")
  203.       {
  204.          s = s.substring(0,j) + " " + s.substring(j + 1);
  205.       }
  206.       j++;
  207.    }
  208.    return s;
  209. }
  210. function splitAtIndexes(lineLen, sline, linecount, indexArray)
  211. {
  212.    if(splitAtIndexes.last_j == null || lineLen == 0)
  213.    {
  214.       splitAtIndexes.last_j = 0;
  215.    }
  216.    var arr = new Array();
  217.    var startIndex = 0;
  218.    var lastEndIndex = 0;
  219.    var si;
  220.    var ei;
  221.    var staticChunk;
  222.    var fillChunk;
  223.    var j = splitAtIndexes.last_j;
  224.    while(j < indexArray.length)
  225.    {
  226.       splitAtIndexes.last_j = j;
  227.       si = indexArray.startIndex[j] - lineLen - linecount;
  228.       ei = indexArray.endIndex[j] - lineLen - linecount;
  229.       if(!(ei <= sline.length && si >= 0))
  230.       {
  231.          break;
  232.       }
  233.       if(si > 0 || si > lastEndIndex)
  234.       {
  235.          staticChunk = {text:sline.substring(lastEndIndex,si)};
  236.          arr.push(staticChunk);
  237.       }
  238.       fillChunk = {text:sline.substring(si,ei),isBlank:true};
  239.       arr.push(fillChunk);
  240.       lastEndIndex = ei;
  241.       j++;
  242.    }
  243.    if(lastEndIndex != sline.length)
  244.    {
  245.       staticChunk = {text:sline.substring(lastEndIndex)};
  246.       arr.push(staticChunk);
  247.    }
  248.    return arr;
  249. }
  250. function createFillBox(s, px, py, w, id)
  251. {
  252.    var ilist = createIndexList(s);
  253.    var tempstr = s.multiSplit(TAGS.BLANK_OPEN,TAGS.BLANK_CLOSE);
  254.    var testStr = tempstr.join("");
  255.    var ts;
  256.    var te;
  257.    this.createTextField("__fio__",613147,0,0,w,0);
  258.    __fio__.wordWrap = true;
  259.    __fio__.multiline = true;
  260.    __fio__.border = true;
  261.    __fio__.autoSize = true;
  262.    __fio__.embedFonts = true;
  263.    __fio__.text = makeForceNoWrap(testStr,ilist);
  264.    __fio__.setTextFormat(layoutInfo.qStaticText);
  265.    var lines = __fio__.getLines();
  266.    __fio__.removeTextField();
  267.    var tb_pos = {x:px,y:py};
  268.    var last_j = 0;
  269.    var track_j = 0;
  270.    var last_x = 0;
  271.    var lastIndex = 0;
  272.    var totalLineLen = 0;
  273.    var atxt = [];
  274.    var fullTextLine = "";
  275.    var lastTFClip = null;
  276.    var tabCounter = 100;
  277.    var line;
  278.    var txt;
  279.    var chunk;
  280.    var lineChunks;
  281.    var oldtxt;
  282.    var tqm;
  283.    var tq;
  284.    var tam;
  285.    var tm;
  286.    var chunkText;
  287.    s;
  288.    var fibHolderRef = this.createEmptyMovieClip("fibHolder" + id,depth++);
  289.    fibHolderRef._x = tb_pos.x;
  290.    fibHolderRef._y = tb_pos.y;
  291.    fibHolderRef.gAnswerBoxes = [];
  292.    fibHolderRef.isRemoveable = true;
  293.    var i = 0;
  294.    while(i < lines.length)
  295.    {
  296.       line = lines[i];
  297.       fullTextLine += line + " ";
  298.       s;
  299.       s;
  300.       fibHolderRef.createTextField("tx" + i,1 + i,0,0,w,0);
  301.       txt = fibHolderRef["tx" + i];
  302.       atxt.push(txt);
  303.       txt.border = false;
  304.       txt.autoSize = true;
  305.       txt.embedFonts = true;
  306.       txt.text = lines[i];
  307.       txt.setTextFormat(layoutInfo.qStaticText);
  308.       if(i > 0)
  309.       {
  310.          oldtxt = fibHolderRef["tx" + (i - 1)];
  311.          txt._y = oldtxt._y + oldtxt._height + 2;
  312.       }
  313.       lineChunks = new Array();
  314.       startIndex = 0;
  315.       lineChunks = splitAtIndexes(totalLineLen,line,0,ilist);
  316.       var j = 0;
  317.       while(j < lineChunks.length)
  318.       {
  319.          chunk = lineChunks[j];
  320.          chunkText = chunk.text;
  321.          if(chunk.isBlank == undefined)
  322.          {
  323.             te = layoutInfo.qStaticText.cGetTextExtent(chunkText);
  324.             tqm = fibHolderRef.createEmptyMovieClip("tqm" + i + "_" + i,depth++);
  325.             tqm.isRemoveable = true;
  326.             tqm._x = txt._x + last_x;
  327.             tqm._y = txt._y;
  328.             tqm.createTextField("txt",1,0,0,te.width,te.height);
  329.             tq = tqm.txt;
  330.             tq.type = "dynamic";
  331.             tq.selectable = false;
  332.             tq.embedFonts = true;
  333.             tq.text = chunkText;
  334.             tq.setTextFormat(layoutInfo.qStaticText);
  335.             tq.setNewTextFormat(layoutInfo.qStaticText);
  336.             s;
  337.             lastTFClip = tqm;
  338.          }
  339.          else
  340.          {
  341.             te2 = layoutInfo.qStaticText.cGetTextExtent(chunkText);
  342.             tam = fibHolderRef.createEmptyMovieClip("tam" + i + "_" + j,depth++);
  343.             tam.isRemoveable = true;
  344.             tam._x = lastTFClip != null ? last_x : txt._x;
  345.             tam._y = txt._y;
  346.             tam.createTextField("txt",1,0,0,te2.width + 4,te2.height);
  347.             ta = tam.txt;
  348.             fibHolderRef.gAnswerBoxes.push(ta);
  349.             gAnswerBoxes.push(ta);
  350.             ta.type = "input";
  351.             ta.selectable = true;
  352.             ta.border = true;
  353.             ta.borderColor = 13421772;
  354.             ta.embedFonts = true;
  355.             ta.tabIndex = tabCounter++;
  356.             ta.correctAnswer = removeForceNoWrap(chunkText);
  357.             ta.setNewTextFormat(layoutInfo.qFillText);
  358.             s;
  359.             lastTFClip = tam;
  360.          }
  361.          last_x = lastTFClip._x + lastTFClip._width;
  362.          j++;
  363.       }
  364.       lastTFClip = null;
  365.       lastIndex = 0;
  366.       last_x = 0;
  367.       totalLineLen = fullTextLine.length;
  368.       i++;
  369.    }
  370.    var i = 0;
  371.    while(i < atxt.length)
  372.    {
  373.       atxt[i].removeTextField();
  374.       i++;
  375.    }
  376.    return fibHolderRef;
  377. }
  378. function render()
  379. {
  380.    depth = 1000;
  381.    tabOrder = 4000;
  382.    _global.gAnswerBoxes = new Array();
  383.    clearClip();
  384.    tableY = layoutInfo.box.y;
  385.    rightSideBuffer = layoutInfo.rightSideBuffer;
  386.    topBuffer = 0;
  387.    if(master.hasVideoPlayer)
  388.    {
  389.       tableY = layoutInfo.temp4InstY;
  390.       topBuffer = master.videoPlayer._height;
  391.       rightSideBuffer = 250;
  392.    }
  393.    if(master.hasMediaFrame)
  394.    {
  395.       rightSideBuffer = 250;
  396.    }
  397.    var title_mc;
  398.    var inst_mc;
  399.    if(ai.titleSpanish)
  400.    {
  401.       title_mc = createTitleField(ai.titleSpanish);
  402.       title_mc.isRemoveable = true;
  403.       title_mc._x = layoutInfo.box.x;
  404.       title_mc._y = layoutInfo.box.y + topBuffer;
  405.       tableY = title_mc._y + title_mc._height;
  406.    }
  407.    if(ai.instructionsEnglish || ai.instructionsSpanish)
  408.    {
  409.       if(ai.instructionsEnglish != null)
  410.       {
  411.          var instText = ai.instructionsEnglish.text;
  412.       }
  413.       else
  414.       {
  415.          var instText = ai.instructionsSpanish.text;
  416.       }
  417.       pinstText = ai["instructions" + PMSI.instructionLanguage].text;
  418.       instText = pinstText != null ? pinstText : instText;
  419.       inst_mc = this.createInstructionField(this,"inst",instText);
  420.       inst_mc.isRemoveable = true;
  421.       inst_mc._x = layoutInfo.box.x;
  422.       inst_mc._y = title_mc == null ? tableY : title_mc._y + title_mc._height;
  423.       inst_mc._height;
  424.       tableY = inst_mc._y + inst_mc._height + 10;
  425.       this.instructionField = inst_mc;
  426.       trace("tableY: " + tableY);
  427.       trace("inst_mc._y + inst_mc._height + 10; " + (inst_mc._y + inst_mc._height + 10));
  428.    }
  429.    if(ai.model)
  430.    {
  431.       this.attachMovie("modeloButton","modelBtn",10);
  432.       modelBtn._x = layoutInfo.box.x;
  433.       modelBtn._y = tableY - 10;
  434.       trace("modelBtn._y" + modelBtn._y);
  435.       modelBtn.isMoveable = true;
  436.       this.attachMovie("modeloBox","modeloBox",100000);
  437.       modeloBox.isRemoveable = true;
  438.       modeloBox._visible = false;
  439.       modelBtn.onRelease = function()
  440.       {
  441.          if(!this._parent.modeloBox.isBoxDrawn)
  442.          {
  443.             this._parent.modeloBox.drawPopUp(ai.model.text);
  444.             this._parent.modeloBox.isBoxDrawn = true;
  445.          }
  446.          this._parent.modeloBox._visible = !this._parent.modeloBox._visible;
  447.          this._parent.modeloBox._x = this._x + this._width + 24;
  448.          this._parent.modeloBox._y = this._y + this._height / 2 - 8;
  449.       };
  450.    }
  451.    else
  452.    {
  453.       modelBtn._visible = false;
  454.    }
  455.    if(_parent.actNumber_mc._height > inst_mc._height + title_mc._height)
  456.    {
  457.       tableY = _parent.actNumber_mc._y + _parent.actNumber_mc._height + 10;
  458.    }
  459.    var gtt = getTimer();
  460.    var tfMaxWidth = layoutinfo.MAX_WIDTH;
  461.    var qlist = ai.questions.question;
  462.    var dx = layoutInfo.box.x;
  463.    var dy = tableY + 10;
  464.    var lastClip;
  465.    var fcfb;
  466.    var qstr;
  467.    var qnum;
  468.    var wid;
  469.    var qst;
  470.    var qtb;
  471.    if(qlist.length > 1)
  472.    {
  473.       var i = 0;
  474.       while(i < qlist.length)
  475.       {
  476.          qst = qlist[i];
  477.          qnum = createNumberField("qnum" + i,i + 1 + ".",i);
  478.          qnum.isRemoveable = true;
  479.          qnum.isMoveable = true;
  480.          qstr = qlist[i].questionText.text;
  481.          dy = i != 0 ? lastClip._y + lastClip._height + 10 : dy;
  482.          qnum._y = dy;
  483.          qnum._x = dx;
  484.          wid = tfMaxWidth - rightSideBuffer - qnum._width - 10;
  485.          if(qst.questionText)
  486.          {
  487.             qtb = createQuestionField("gtb" + i,qst.questionText.text,wid,i);
  488.             qtb._x = dx + qnum._width + 10;
  489.             qtb._y = dy;
  490.             qtb.isRemoveable = true;
  491.             qtb.isMoveable = true;
  492.          }
  493.          if(ai.isScoreable.text == "y")
  494.          {
  495.             feedbackCheck = this.attachMovie("check","chk" + depth++,depth);
  496.             feedbackCheck.isRemoveable = true;
  497.             feedbackCheck.isMoveable = true;
  498.          }
  499.          fcfb = createShortAnswerField("sab_box" + i,wid - feedBackCheck._width,i);
  500.          fcfb.content.feedBackCheck = feedbackCheck;
  501.          fcfb.content.tabIndex = tabOrder++;
  502.          fcfb.content.correctAnswer = qst.correctAnswer.text;
  503.          fcfb._x = qtb != null ? qtb._x : dx + qnum._width + 10;
  504.          fcfb._y = qtb != null ? qtb._y + qtb._height + 2 : dy;
  505.          feedbackCheck._x = fcfb._x + fcfb._width;
  506.          feedbackCheck._y = fcfb._y;
  507.          fcfb.isRemoveable = true;
  508.          fcfb.isMoveable = true;
  509.          lastClip = fcfb;
  510.          gAnswerBoxes[i] = fcfb.content;
  511.          i++;
  512.       }
  513.    }
  514.    else
  515.    {
  516.       var mc = this.createEmptyMovieClip("bigField",6220);
  517.       mc.isRemoveable = true;
  518.       mc.isMoveable = true;
  519.       mc.createTextField("content",1,0,0,0,0);
  520.       var tf = layoutInfo.qFillText;
  521.       var te = tf.cGetTextExtent("_");
  522.       tf.align = "left";
  523.       mc.content.embedFonts = true;
  524.       mc.content.tabIndex = tabOrder++;
  525.       mc.content.border = true;
  526.       mc.content.borderColor = layoutInfo.qFillText.color;
  527.       mc.content.type = "input";
  528.       mc.content.setTextFormat(tf);
  529.       mc.content._height = te.height * 6;
  530.       mc.content.wordWrap = true;
  531.       mc.content.multiline = true;
  532.       mc.content._width = tfMaxWidth - rightSideBuffer;
  533.       mc.content.autoSize = false;
  534.       mc.content.selectable = true;
  535.       mc.content.setNewTextFormat(tf);
  536.       mc._x = dx;
  537.       mc._y = dy;
  538.       Selection.setFocus(mc.content);
  539.       gAnswerBoxes[0] = mc.content;
  540.    }
  541.    _global.defaultBox = gAnswerBoxes[0];
  542.    initDiacriticalHandlers();
  543.    s;
  544.    if(ai.audioFile)
  545.    {
  546.       this.gotoAndStop("higher");
  547.    }
  548.    else if(ai.artFile)
  549.    {
  550.       this.gotoAndStop("high");
  551.    }
  552.    else
  553.    {
  554.       this.gotoAndStop("default");
  555.    }
  556. }
  557. function drawDottedLine(x, y, w)
  558. {
  559.    var mcdl = this.createEmptyMovieClip("dotline",depth++);
  560.    mcdl._x = x;
  561.    mcdl._y = y;
  562.    mcdl.lineStyle(2,13421772,50);
  563.    var d = 0;
  564.    while(d < w)
  565.    {
  566.       if(d % 8 == 0)
  567.       {
  568.          mcdl.moveTo(d + 8,0);
  569.          mcdl.lineTo(d + 4,0);
  570.       }
  571.       d++;
  572.    }
  573. }
  574. function checkAnswers()
  575. {
  576.    var counter = 0;
  577.    var i = 0;
  578.    while(i < gAnswerBoxes.length)
  579.    {
  580.       if(gAnswerBoxes[i].correctAnswer.trim() == gAnswerBoxes[i].text.trim())
  581.       {
  582.          counter++;
  583.          gAnswerBoxes[i].feedbackCheck.gotoAndStop("correct");
  584.       }
  585.       else
  586.       {
  587.          gAnswerBoxes[i].feedbackCheck.gotoAndStop("incorrect");
  588.       }
  589.       i++;
  590.    }
  591.    master.setFeedback(counter,gAnswerBoxes.length);
  592. }
  593. function toggleBox()
  594. {
  595.    __fio__._visible = !__fio__._visible;
  596. }
  597. function clearClip()
  598. {
  599.    delete _global.gAnswerBoxes;
  600.    _global.gAnswerBoxes = [];
  601.    layoutInfo.qMaxWidthPos = 0;
  602.    layoutInfo.qMaxWidth = 0;
  603.    layoutInfo.a1MaxWidth = 0;
  604.    layoutInfo.a2MaxWidth = 0;
  605.    for(var mcn in this)
  606.    {
  607.       if(this[mcn].isRemoveable)
  608.       {
  609.          this[mcn].clear();
  610.          this[mcn].removeMovieClip();
  611.       }
  612.    }
  613. }
  614. function createTitleField(txt)
  615. {
  616.    var mc = this.createEmptyMovieClip("title",4900);
  617.    mc.createTextField("content",1,0,0,0,0);
  618.    var tf = layoutInfo.titleTextFormat;
  619.    mc.content.embedFonts = true;
  620.    mc.content.border = false;
  621.    mc.content.type = "dynamic";
  622.    mc.content.text = txt;
  623.    mc.content.setTextFormat(tf);
  624.    mc.content.wordWrap = true;
  625.    mc.content.color = layoutInfo.instTextColor;
  626.    mc.content._width = 300;
  627.    mc.content.autoSize = true;
  628.    mc.content.selectable = false;
  629.    return mc;
  630. }
  631. function createQuestionField(name, text, width, id)
  632. {
  633.    var mc = this.createEmptyMovieClip(name,4120 + id);
  634.    mc.createTextField("content",1,0,0,0,0);
  635.    var tf = layoutInfo.qTextFormatSA;
  636.    mc.content.embedFonts = true;
  637.    mc.content.border = false;
  638.    mc.content.type = "dynamic";
  639.    mc.content.text = text;
  640.    mc.content.setTextFormat(tf);
  641.    mc.content._height = 400;
  642.    mc.content.wordWrap = true;
  643.    mc.content.color = layoutInfo.instTextColor;
  644.    mc.content._width = width;
  645.    mc.content.autoSize = true;
  646.    mc.content.selectable = false;
  647.    return mc;
  648. }
  649. function createShortAnswerField(name, width, id)
  650. {
  651.    var mc = this.createEmptyMovieClip(name,6120 + id);
  652.    mc.createTextField("content",1,0,0,0,0);
  653.    var tf = layoutInfo.qFillText;
  654.    tf.align = "left";
  655.    var te = tf.cGetTextExtent("_");
  656.    mc.content.embedFonts = true;
  657.    mc.content.borderColor = 13421772;
  658.    mc.content.type = "input";
  659.    mc.content.text = text;
  660.    mc.content.setNewTextFormat(tf);
  661.    mc.content._height = te.height;
  662.    mc.content.wordWrap = false;
  663.    mc.content._width = width;
  664.    mc.content.autoSize = false;
  665.    mc.content.selectable = true;
  666.    mc.lineStyle(1,layoutInfo.qFillText.color,100);
  667.    mc.drawUnderline();
  668.    return mc;
  669. }
  670. function createNumberField(name, text, dep)
  671. {
  672.    var mc = this.createEmptyMovieClip(name,8101 + dep);
  673.    mc.createTextField("content",1,0,0,40,0);
  674.    var tf = layoutInfo.qNumberText;
  675.    mc.content.embedFonts = true;
  676.    mc.content.border = false;
  677.    mc.content.type = "dynamic";
  678.    mc.content.autoSize = true;
  679.    mc.content.text = text;
  680.    mc.content.setTextFormat(tf);
  681.    mc.content.selectable = false;
  682.    return mc;
  683. }
  684. if(_global.PMSI == null)
  685. {
  686.    _global.PMSI = {};
  687.    PMSI.VENDOR_NAME = "Purple Monkey Studios, Inc.";
  688.    PMSI.DefList = {};
  689. }
  690. String.prototype.trim = function()
  691. {
  692.    return this.rtrim().ltrim();
  693. };
  694. String.prototype.rtrim = function()
  695. {
  696.    var i = this.length - 1;
  697.    while(i >= 0 && this.charCodeAt(i) <= 32)
  698.    {
  699.       i--;
  700.    }
  701.    return this.substring(0,i + 1);
  702. };
  703. String.prototype.ltrim = function()
  704. {
  705.    var i = 0;
  706.    while(i < this.length && this.charCodeAt(i) <= 32)
  707.    {
  708.       i++;
  709.    }
  710.    return this.substring(i);
  711. };
  712. String.prototype.isWhiteSpace = function()
  713. {
  714.    var i = 0;
  715.    while(i < this.length)
  716.    {
  717.       if(this.charCodeAt(i) > 32)
  718.       {
  719.          return false;
  720.       }
  721.       i++;
  722.    }
  723.    return true;
  724. };
  725. String.prototype.toCharArray = function()
  726. {
  727.    return this.split("");
  728. };
  729. Array.prototype.charArrayToString = function()
  730. {
  731.    return this.join("");
  732. };
  733. String.prototype.reverse = function()
  734. {
  735.    return this.split("").reverse().join("");
  736. };
  737. String.prototype.multiSplit = function()
  738. {
  739.    var master;
  740.    var dummy;
  741.    var args;
  742.    master = this.split(arguments[0]);
  743.    var i = 1;
  744.    while(i < arguments.length)
  745.    {
  746.       var j = 0;
  747.       while(j < master.length)
  748.       {
  749.          dummy = master[j].split(arguments[i]);
  750.          if(dummy.length > 1)
  751.          {
  752.             args = [j,1];
  753.             args = args.concat(dummy);
  754.             master.splice.apply(master,args);
  755.          }
  756.          j++;
  757.       }
  758.       i++;
  759.    }
  760.    return master;
  761. };
  762. String.prototype.replace = function(srch, repl)
  763. {
  764.    return this.split(srch).join(repl);
  765. };
  766. XML.prototype.ELEMENT_NODE = 1;
  767. XML.prototype.TEXT_NODE = 3;
  768. XML.prototype._inorderItr = function(node, fnPtr)
  769. {
  770.    var stack = new Array();
  771.    var node = node;
  772.    while(true)
  773.    {
  774.       if(node)
  775.       {
  776.          stack.push(node);
  777.          node = node.firstChild;
  778.       }
  779.       else
  780.       {
  781.          node = stack.pop();
  782.          if(!node)
  783.          {
  784.             break;
  785.          }
  786.          fnPtr(node);
  787.          node = node.nextSibling;
  788.       }
  789.    }
  790.    delete stack;
  791. };
  792. XMLNode.prototype._inorderItr = XML.prototype._inorderItr;
  793. XML.prototype._inorderRec = function(node, fnPtr)
  794. {
  795.    function helperR(node_xml)
  796.    {
  797.       if(node_xml == null)
  798.       {
  799.          return undefined;
  800.       }
  801.       this.fnPtr(node_xml);
  802.       helperR(node_xml.firstChild);
  803.       helperR(node_xml.nextSibling);
  804.    }
  805.    var outer = this;
  806.    helperR(node);
  807. };
  808. XMLNode.prototype._inorderRec = XML.prototype._inorderRec;
  809. XMLNode.prototype.addProperty("text",this.ext_XML_GET_TEXT,this.ext_XML_SET_TEXT);
  810. XML.prototype.addProperty("text",this.ext_XML_GET_TEXT,this.ext_XML_SET_TEXT);
  811. XML.prototype.getElementsByTagName = function(tagName)
  812. {
  813.    function processNode(node)
  814.    {
  815.       if(node.nodeName != null && node.nodeName == tagName)
  816.       {
  817.          nodelist.push(node);
  818.       }
  819.    }
  820.    var nodelist = new Array();
  821.    this._inorderItr(this,processNode);
  822.    return nodelist;
  823. };
  824. XMLNode.prototype.getElementsByTagName = XML.prototype.getElementsByTagName;
  825. XML.prototype.getElementsByTagNames = function()
  826. {
  827.    function processNode(node)
  828.    {
  829.       var i = 0;
  830.       while(i < args.length)
  831.       {
  832.          if(node.nodeName != null && node.nodeName == args[i])
  833.          {
  834.             trace("Found: " + args[i]);
  835.             if(nodelists[i] == undefined)
  836.             {
  837.                nodelists[i] = new Array();
  838.             }
  839.             nodelists[i].push(node);
  840.             break;
  841.          }
  842.          i++;
  843.       }
  844.    }
  845.    var args = arguments;
  846.    var nodelists = new Array(arguments.length);
  847.    this._inorderItr(this,processNode);
  848.    return nodelists;
  849. };
  850. XMLNode.prototype.getElementsByTagNames = XML.prototype.getElementsByTagNames;
  851. XML.prototype.getValueAtTagName = function(tagName)
  852. {
  853.    function processNode(node)
  854.    {
  855.       if(node.nodeName != null && node.nodeName == tagName)
  856.       {
  857.          nodelist.push(node);
  858.       }
  859.    }
  860.    var nodelist = new Array();
  861.    var textValue = null;
  862.    this._inorderItr(this,processNode);
  863.    if(nodeList.length >= 1)
  864.    {
  865.       textValue = nodeList[0].text;
  866.    }
  867.    return textValue;
  868. };
  869. XMLNode.prototype.getValueAtTagName = XML.prototype.getValueAtTagName;
  870. XML.prototype.getAttribute = function(name)
  871. {
  872.    return this.attributes[name];
  873. };
  874. XMLNode.prototype.getAttribute = XML.prototype.getAttribute;
  875. XML.prototype.setAttribute = function(name, value)
  876. {
  877.    this.attributes[name] = value;
  878. };
  879. XMLNode.prototype.setAttribute = XML.prototype.setAttribute;
  880. XML.prototype.hasAttribute = function(name)
  881. {
  882.    var attrs = this.attributes;
  883.    for(var mc in attrs)
  884.    {
  885.       if(name == mc)
  886.       {
  887.          return true;
  888.       }
  889.    }
  890.    return false;
  891. };
  892. XMLNode.prototype.hasAttribute = XML.prototype.hasAttribute;
  893. XML.prototype.removeAttribute = function(name)
  894. {
  895.    var attr = this.attributes[name];
  896.    delete this.attributes[name];
  897.    return attr;
  898. };
  899. XMLNode.prototype.setAttribute = XML.prototype.setAttribute;
  900. XMLNode.prototype.getOwnerDocument = function()
  901. {
  902.    var odc = this;
  903.    var lastNode = this;
  904.    while(odc)
  905.    {
  906.       lastNode = odc;
  907.       odc = odc.parentNode;
  908.    }
  909.    return !(lastNode instanceof XML) ? null : lastNode;
  910. };
  911. XML.prototype.normalize = function()
  912. {
  913.    function process(node)
  914.    {
  915.       nodeList.push(node);
  916.    }
  917.    var outer = this;
  918.    var nodeList = new Array();
  919.    this._inorderItr(this,process);
  920.    var i = 0;
  921.    while(i < nodeList.length)
  922.    {
  923.       var node = nodeList[i];
  924.       if(node.nodeType == XML.prototype.TEXT_NODE && node.nodeValue.isWhiteSpace())
  925.       {
  926.          trace("removing node");
  927.          node.removeNode();
  928.       }
  929.       else if(node.nodeType == XML.prototype.TEXT_NODE)
  930.       {
  931.          node.nodeValue = node.nodeValue.trim();
  932.       }
  933.       i++;
  934.    }
  935.    delete nodeList;
  936. };
  937. XMLNode.prototype.normalize = XML.prototype.normalize;
  938. XMLNode.prototype.getDepth = function()
  939. {
  940.    var i = 0;
  941.    var node = this;
  942.    while(node)
  943.    {
  944.       node = node.parentNode;
  945.       i++;
  946.    }
  947.    return i;
  948. };
  949. XML.prototype.getElementsWithAttribute = function(name, value)
  950. {
  951.    function processNode(node)
  952.    {
  953.       if(value == null)
  954.       {
  955.          for(var mcz in node.attributes)
  956.          {
  957.             if(mcz == name)
  958.             {
  959.                nodeList.push(node);
  960.                break;
  961.             }
  962.          }
  963.       }
  964.       else if(node.attributes[name] == value)
  965.       {
  966.          nodeList.push(node);
  967.       }
  968.    }
  969.    if(name == null)
  970.    {
  971.       return undefined;
  972.    }
  973.    var nodeList = new Array();
  974.    this._inorderItr(this,processNode);
  975.    return nodeList;
  976. };
  977. XMLNode.prototype.getElementsWithAttribute = XML.prototype.getElementsWithAttribute;
  978. XMLNode.prototype.getPath = function(path)
  979. {
  980.    function process(node)
  981.    {
  982.       trace(node.nodeName);
  983.       if(node.nodeName != null && node.nodeName == currentPart && i < pathParts.length)
  984.       {
  985.          trace("Found: " + currentPart);
  986.          partTable[i] = node.parentNode.getElementsByTagName(currentPart);
  987.          currentPart = pathParts[++i];
  988.       }
  989.    }
  990.    var i = 0;
  991.    var pathParts = path.split("/");
  992.    var currentPart = pathParts[i];
  993.    var partTable = new Array();
  994.    this._inorderItr(this,process);
  995.    return partTable[partTable.length - 1];
  996. };
  997. XML.prototype.getPath = XMLNode.prototype.getPath;
  998. MovieClip.prototype.isLoading = function()
  999. {
  1000.    return this.getBytesLoaded() > 4 && this.getBytesTotal() > this.getBytesLoaded();
  1001. };
  1002. MovieClip.prototype.getPercentLoaded = function()
  1003. {
  1004.    return Math.round(this.getBytesLoaded() / this.getBytesTotal() * 100);
  1005. };
  1006. MovieClip.prototype.isLoaded = function()
  1007. {
  1008.    return !this.isLoading();
  1009. };
  1010. MovieClip.prototype._sol = function(f)
  1011. {
  1012.    if(MovieClip.prototype.__onLoadHandler__ == undefined)
  1013.    {
  1014.       MovieClip.prototype.__onLoadHandler__ = {};
  1015.    }
  1016.    MovieClip.prototype.__onLoadHandler__[this] = f;
  1017. };
  1018. MovieClip.prototype._gol = function()
  1019. {
  1020.    return MovieClip.prototype.__onLoadHandler__[this];
  1021. };
  1022. MovieClip.prototype.addProperty("onLoad",MovieClip.prototype._gol,MovieClip.prototype._sol);
  1023. MovieClip.prototype._sod = function(f)
  1024. {
  1025.    if(MovieClip.prototype.__onDataHandler__ == undefined)
  1026.    {
  1027.       MovieClip.prototype.__onDataHandler__ = {};
  1028.    }
  1029.    MovieClip.prototype.__onDataHandler__[this] = f;
  1030. };
  1031. MovieClip.prototype._god = function()
  1032. {
  1033.    return MovieClip.prototype.__onDataHandler__[this];
  1034. };
  1035. MovieClip.prototype.addProperty("onData",MovieClip.prototype._god,MovieClip.prototype._sod);
  1036. MovieClip.prototype.load = MovieClip.prototype.loadMovie;
  1037. MovieClip.prototype.drawOval = function(x, y, radius, yRadius)
  1038. {
  1039.    if(arguments.length < 3)
  1040.    {
  1041.       return undefined;
  1042.    }
  1043.    var theta;
  1044.    var xrCtrl;
  1045.    var yrCtrl;
  1046.    var angle;
  1047.    var angleMid;
  1048.    var px;
  1049.    var py;
  1050.    var cx;
  1051.    var cy;
  1052.    if(yRadius == undefined)
  1053.    {
  1054.       yRadius = radius;
  1055.    }
  1056.    theta = 0.7853981633974483;
  1057.    xrCtrl = radius / Math.cos(theta / 2);
  1058.    yrCtrl = yRadius / Math.cos(theta / 2);
  1059.    angle = 0;
  1060.    this.moveTo(x + radius,y);
  1061.    var i = 0;
  1062.    while(i < 8)
  1063.    {
  1064.       angle += theta;
  1065.       angleMid = angle - theta / 2;
  1066.       cx = x + Math.cos(angleMid) * xrCtrl;
  1067.       cy = y + Math.sin(angleMid) * yrCtrl;
  1068.       px = x + Math.cos(angle) * radius;
  1069.       py = y + Math.sin(angle) * yRadius;
  1070.       this.curveTo(cx,cy,px,py);
  1071.       i++;
  1072.    }
  1073. };
  1074. MovieClip.prototype.drawCircle = function(x, y, r)
  1075. {
  1076.    this.drawOval(x,y,r);
  1077. };
  1078. MovieClip.prototype.drawSquare = function(x, y, w)
  1079. {
  1080.    this.drawRect(x,y,w,w);
  1081. };
  1082. MovieClip.prototype.drawEgg = function(x, y, r)
  1083. {
  1084.    var rx = r / 1.618;
  1085.    var ry = r;
  1086.    var ry1 = 2 * ry * 0.618;
  1087.    var ry2 = 2 * ry * 0.382;
  1088.    this.moveTo(x + rx,y);
  1089.    this.curveTo(rx + x,-0.4142 * ry1 + y,0.7071 * rx + x,-0.7071 * ry1 + y);
  1090.    this.curveTo(0.4142 * rx + x,- ry1 + y,x,- ry1 + y);
  1091.    this.curveTo(-0.4142 * rx + x,- ry1 + y,-0.7071 * rx + x,-0.7071 * ry1 + y);
  1092.    this.curveTo(- rx + x,-0.4142 * ry1 + y,- rx + x,y);
  1093.    this.curveTo(- rx + x,0.4142 * ry2 + y,-0.7071 * rx + x,0.7071 * ry2 + y);
  1094.    this.curveTo(-0.4142 * rx + x,ry2 + y,x,ry2 + y);
  1095.    this.curveTo(0.4142 * rx + x,ry2 + y,0.7071 * rx + x,0.7071 * ry2 + y);
  1096.    this.curveTo(rx + x,0.4142 * ry2 + y,rx + x,y);
  1097. };
  1098. MovieClip.prototype.drawRect = function(x, y, w, h, cornerRadius)
  1099. {
  1100.    if(arguments.length < 4)
  1101.    {
  1102.       return undefined;
  1103.    }
  1104.    if(cornerRadius > 0)
  1105.    {
  1106.       var theta;
  1107.       var angle;
  1108.       var cx;
  1109.       var cy;
  1110.       var px;
  1111.       var py;
  1112.       if(cornerRadius > Math.min(w,h) / 2)
  1113.       {
  1114.          cornerRadius = Math.min(w,h) / 2;
  1115.       }
  1116.       theta = 0.7853981633974483;
  1117.       this.moveTo(x + cornerRadius,y);
  1118.       this.lineTo(x + w - cornerRadius,y);
  1119.       angle = -1.5707963267948966;
  1120.       cx = x + w - cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1121.       cy = y + cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1122.       px = x + w - cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1123.       py = y + cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1124.       this.curveTo(cx,cy,px,py);
  1125.       angle += theta;
  1126.       cx = x + w - cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1127.       cy = y + cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1128.       px = x + w - cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1129.       py = y + cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1130.       this.curveTo(cx,cy,px,py);
  1131.       this.lineTo(x + w,y + h - cornerRadius);
  1132.       angle += theta;
  1133.       cx = x + w - cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1134.       cy = y + h - cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1135.       px = x + w - cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1136.       py = y + h - cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1137.       this.curveTo(cx,cy,px,py);
  1138.       angle += theta;
  1139.       cx = x + w - cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1140.       cy = y + h - cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1141.       px = x + w - cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1142.       py = y + h - cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1143.       this.curveTo(cx,cy,px,py);
  1144.       this.lineTo(x + cornerRadius,y + h);
  1145.       angle += theta;
  1146.       cx = x + cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1147.       cy = y + h - cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1148.       px = x + cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1149.       py = y + h - cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1150.       this.curveTo(cx,cy,px,py);
  1151.       angle += theta;
  1152.       cx = x + cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1153.       cy = y + h - cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1154.       px = x + cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1155.       py = y + h - cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1156.       this.curveTo(cx,cy,px,py);
  1157.       this.lineTo(x,y + cornerRadius);
  1158.       angle += theta;
  1159.       cx = x + cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1160.       cy = y + cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1161.       px = x + cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1162.       py = y + cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1163.       this.curveTo(cx,cy,px,py);
  1164.       angle += theta;
  1165.       cx = x + cornerRadius + Math.cos(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1166.       cy = y + cornerRadius + Math.sin(angle + theta / 2) * cornerRadius / Math.cos(theta / 2);
  1167.       px = x + cornerRadius + Math.cos(angle + theta) * cornerRadius;
  1168.       py = y + cornerRadius + Math.sin(angle + theta) * cornerRadius;
  1169.       this.curveTo(cx,cy,px,py);
  1170.    }
  1171.    else
  1172.    {
  1173.       this.moveTo(x,y);
  1174.       this.lineTo(x + w,y);
  1175.       this.lineTo(x + w,y + h);
  1176.       this.lineTo(x,y + h);
  1177.       this.lineTo(x,y);
  1178.    }
  1179. };
  1180. MovieClip.prototype.getCenterPoint = function()
  1181. {
  1182.    return {x:this._width / 2,y:this._height / 2};
  1183. };
  1184. MovieClip.prototype.drawDebugBorderD = function()
  1185. {
  1186.    this.lineStyle(1,0,25);
  1187.    var x;
  1188.    var y = 0;
  1189.    var w = this._width;
  1190.    var h = this._height;
  1191.    this.moveTo(x,y);
  1192.    this.lineTo(x + w,y);
  1193.    this.lineTo(x + w,y + h);
  1194.    this.lineTo(x,y + h);
  1195.    this.lineTo(x,y);
  1196. };
  1197. MovieClip.prototype.drawUnderline = function(len)
  1198. {
  1199.    len = len != null ? len : this._width;
  1200.    this.moveTo(0,this._height);
  1201.    this.lineTo(len,this._height);
  1202. };
  1203. if(PMSI.DepthManager == undefined)
  1204. {
  1205.    PMSI.DepthManager = {};
  1206.    PMSI.DepthManager._$depth = 0;
  1207.    PMSI.DepthManager.getNextDepth = function()
  1208.    {
  1209.       var next_depth = ++this._$depth;
  1210.       while(this._$depthsClaimed["dc" + next_depth])
  1211.       {
  1212.          next_depth = ++this._$depth;
  1213.       }
  1214.       return next_depth;
  1215.    };
  1216.    PMSI.DepthManager.reserveDepth = function(d)
  1217.    {
  1218.       if(this._$depthsClaimed == null)
  1219.       {
  1220.          this._$depthsClaimed = {};
  1221.       }
  1222.       if(d == null)
  1223.       {
  1224.          var d = ++this._$depth;
  1225.       }
  1226.       while(this._$depthsClaimed["dc" + d])
  1227.       {
  1228.          d++;
  1229.       }
  1230.       this._$depthsClaimed["dc" + d] = d;
  1231.       return d;
  1232.    };
  1233. }
  1234. ActivityInfoItem.prototype.toString = function()
  1235. {
  1236.    return this.text;
  1237. };
  1238. ActivityInfo.prototype.getIdString = function(separator)
  1239. {
  1240.    var sep = separator != null ? separator : ".";
  1241.    var idStr = "C" + this.activity.course + sep;
  1242.    idStr += "U" + this.activity.unit + sep;
  1243.    idStr += "S" + this.activity.section + sep;
  1244.    idStr += this.activity.topic + sep;
  1245.    if(this.activity.topicSet)
  1246.    {
  1247.       idStr += this.activity.topicSet + sep;
  1248.    }
  1249.    idStr += this.activity.difficultyLevel + this.activity.number.text;
  1250.    return idStr;
  1251. };
  1252. ActivityInfo.prototype.getId = ActivityInfo.prototype.getIdString;
  1253. ActivityInfo.prototype.getType = function()
  1254. {
  1255.    return this.activity.type;
  1256. };
  1257. ActivityInfo.prototype.hasAudio = function()
  1258. {
  1259.    return this.activity.audioFile == null ? false : true;
  1260. };
  1261. ActivityInfo.prototype.hasVideo = function()
  1262. {
  1263.    return this.activity.videoFile == null ? false : true;
  1264. };
  1265. ActivityInfo.prototype.hasPicture = function()
  1266. {
  1267.    return this.activity.artFile == null ? false : true;
  1268. };
  1269. ActivityInfo.prototype.setResolve = function()
  1270. {
  1271.    this.__resolve = ActivityInfo.prototype._myResolve;
  1272. };
  1273. ActivityInfo.prototype._myResolve = function(name)
  1274. {
  1275.    return this.activity[name];
  1276. };
  1277. ActivityInfo.prototype.getBytesLoaded = function()
  1278. {
  1279.    return this.xmlSource.getBytesLoaded();
  1280. };
  1281. ActivityInfo.prototype.getBytesTotal = function()
  1282. {
  1283.    return this.xmlSource.getBytesTotal();
  1284. };
  1285. ActivityInfo.prototype.load = function(url)
  1286. {
  1287.    this._reset();
  1288.    this.xmlSource = new XML();
  1289.    var x = this.xmlSource;
  1290.    x.parent = this;
  1291.    x.ignoreWhite = true;
  1292.    x.createAttributeArray = function(attrs)
  1293.    {
  1294.    };
  1295.    x.onLoad = function(success)
  1296.    {
  1297.       function helperR(node_xml, obj)
  1298.       {
  1299.          if(node_xml == null)
  1300.          {
  1301.             return undefined;
  1302.          }
  1303.          var nName = node_xml.nodeName;
  1304.          if(nName == "number")
  1305.          {
  1306.             nName = "activityNumber";
  1307.          }
  1308.          if(nName != null && obj[nName] == null)
  1309.          {
  1310.             var newObj = new ActivityInfoItem();
  1311.             newObj.text = node_xml.text.trim();
  1312.             if(node_xml.attributes)
  1313.             {
  1314.                trace("creating new attributes array");
  1315.                newObj.attributes = {};
  1316.                for(var oname in node_xml.attributes)
  1317.                {
  1318.                   newObj.attributes[oname] = node_xml.attributes[oname];
  1319.                }
  1320.             }
  1321.             obj[nName] = newObj;
  1322.          }
  1323.          else if(!(obj[nName] instanceof Array) && obj[nName] != null)
  1324.          {
  1325.             var temp = obj[nName];
  1326.             obj[nName] = [];
  1327.             obj[nName].push(temp);
  1328.          }
  1329.          var childObject = obj[nName];
  1330.          if(childObject instanceof Array)
  1331.          {
  1332.             var newObj = new ActivityInfoItem();
  1333.             newObj.text = node_xml.text.trim();
  1334.             if(node_xml.attributes)
  1335.             {
  1336.                trace("creating new attributes array");
  1337.                newObj.attributes = {};
  1338.                for(var oname in node_xml.attributes)
  1339.                {
  1340.                   newObj.attributes[oname] = node_xml.attributes[oname];
  1341.                }
  1342.             }
  1343.             childObject = newObj;
  1344.             obj[nName].push(childObject);
  1345.          }
  1346.          helperR(node_xml.firstChild,childObject);
  1347.          helperR(node_xml.nextSibling,obj);
  1348.       }
  1349.       if(success)
  1350.       {
  1351.          helperR(this.firstChild,this.parent);
  1352.          this.parent.setResolve();
  1353.       }
  1354.       this.parent.onLoad(success);
  1355.    };
  1356.    x.load(url);
  1357. };
  1358. ActivityInfo.prototype._reset = function()
  1359. {
  1360.    delete this.xmlSource;
  1361.    delete this.__resolve;
  1362.    delete this.activity;
  1363. };
  1364. TableClass = function(parent)
  1365. {
  1366.    this.parent = parent;
  1367.    this.reduceTextFields = true;
  1368.    this.rows = [];
  1369.    this.maxCellDims = {width:0,height:0};
  1370.    this.cellPadding = 4;
  1371.    this.cellSpacing = 4;
  1372.    this.colWidthMaxs = [];
  1373.    this.colPercentTable = [];
  1374.    this.borderSize = 1;
  1375.    this.width = 0;
  1376.    this.height = 0;
  1377.    this.oldWidth = this.width;
  1378.    this.oldHeight = this.oldHeight;
  1379.    this.originalWidth = 0;
  1380.    this.x = 0;
  1381.    this.y = 0;
  1382.    this.alteredColumns = {};
  1383.    var dep = PMSI.DepthManager.getNextDepth();
  1384.    this.borderClip = parent.createEmptyMovieClip("TableClassBorder" + dep,dep);
  1385. };
  1386. TableClass.prototype.setPosition = function(position)
  1387. {
  1388.    this.x = position.x;
  1389.    this.y = position.y;
  1390. };
  1391. TableClass.prototype.getPosition = function()
  1392. {
  1393.    return {x:this.x,y:this.y};
  1394. };
  1395. TableClass.prototype.setBorder = function(bsize)
  1396. {
  1397.    this.borderSize = bsize;
  1398. };
  1399. TableClass.prototype.addRow = function(newRow)
  1400. {
  1401.    this.rows.push(newRow);
  1402.    var cells = newRow.cells;
  1403.    var cellCount = cells.length;
  1404.    var cwms = this.colWidthMaxs;
  1405.    var cw = null;
  1406.    var newWidth = 0;
  1407.    var con = null;
  1408.    var c = 0;
  1409.    while(c < cellCount)
  1410.    {
  1411.       con = cells[c].getContent();
  1412.       cw = con == null ? cells[c].width : con._width;
  1413.       if(cwms[c] == null)
  1414.       {
  1415.          cwms[c] = cw;
  1416.       }
  1417.       else
  1418.       {
  1419.          cwms[c] = cw <= cwms[c] ? cwms[c] : cw;
  1420.       }
  1421.       newWidth += cwms[c];
  1422.       c++;
  1423.    }
  1424.    this.originalWidth = newWidth;
  1425.    this.width = newWidth;
  1426.    trace("NEW WIDTH: " + this.width);
  1427. };
  1428. TableClass.prototype.addRowSpacer = function(height, width, numCols)
  1429. {
  1430.    if(numCols == null && this.rows.length == 0)
  1431.    {
  1432.       return undefined;
  1433.    }
  1434.    numCols = this.rows[0].cells.length;
  1435.    var spacerRow = new TableRow();
  1436.    var spacerCell = null;
  1437.    var i = 0;
  1438.    while(i < numCols)
  1439.    {
  1440.       spacerCell = new TableCell();
  1441.       spacerCell.height = height;
  1442.       spacerCell.width = width;
  1443.       spacerRow.addCell(spacerCell);
  1444.       i++;
  1445.    }
  1446.    this.addRow(spacerRow);
  1447. };
  1448. TableClass.prototype.setCellPadding = function(cellPadding)
  1449. {
  1450.    this.cellPadding = cellPadding;
  1451.    this.redraw();
  1452. };
  1453. TableClass.prototype.setCellSpacing = function(cellSpacing)
  1454. {
  1455.    this.cellSpacing = cellSpacing;
  1456.    this.redraw();
  1457. };
  1458. TableClass.prototype.setWidth = function(width)
  1459. {
  1460.    this.oldWidth = this.width;
  1461.    this.width = width;
  1462.    this._recalcDimensions(width);
  1463.    this.redraw();
  1464.    this.redraw();
  1465. };
  1466. TableClass.prototype.setHeight = function(height)
  1467. {
  1468.    this.oldHeight = this.height;
  1469.    this.height = height;
  1470.    this.redraw();
  1471. };
  1472. TableClass.prototype.redraw = function()
  1473. {
  1474.    this.borderClip.clear();
  1475.    var rows = this.rows;
  1476.    var rc = rows.length;
  1477.    var tmdims = this.maxCellDims;
  1478.    var x;
  1479.    var y;
  1480.    var r;
  1481.    var cc;
  1482.    var con;
  1483.    var cols;
  1484.    var rmdims;
  1485.    var cell;
  1486.    var cmax;
  1487.    var offset;
  1488.    var voffset;
  1489.    var cwid;
  1490.    var wprec;
  1491.    var newwid;
  1492.    var lastColMax = null;
  1493.    var cpad = this.cellPadding;
  1494.    var cspace = this.cellSpacing;
  1495.    var r = 0;
  1496.    while(r < rc)
  1497.    {
  1498.       cols = rows[r].cells;
  1499.       cc = cols.length;
  1500.       rmdims = rows[r - 1].maxCellDims;
  1501.       if(r == 0)
  1502.       {
  1503.          y = this.y;
  1504.       }
  1505.       else
  1506.       {
  1507.          y += rmdims.height + this.cellSpacing;
  1508.       }
  1509.       var c = 0;
  1510.       while(c < cc)
  1511.       {
  1512.          cell = cols[c];
  1513.          con = cell.getContent();
  1514.          cwid = this.colWidthMaxs[c];
  1515.          this._resizeTextfield(con,cwid);
  1516.          if(cell.halign == "right")
  1517.          {
  1518.             offset = cwid - con._width;
  1519.          }
  1520.          else if(cell.halign == "center")
  1521.          {
  1522.             offset = (cwid - con._width) / 2;
  1523.          }
  1524.          else
  1525.          {
  1526.             offset = 0;
  1527.          }
  1528.          if(cell.valign == "bottom")
  1529.          {
  1530.             voffset = rows[r].maxCellDims.height - con._height;
  1531.          }
  1532.          else if(cell.valign == "center")
  1533.          {
  1534.             voffset = (rows[r].maxCellDims.height - con._height) / 2;
  1535.          }
  1536.          else
  1537.          {
  1538.             voffset = 0;
  1539.          }
  1540.          if(c == 0)
  1541.          {
  1542.             x = this.x;
  1543.             lastColMax = cwid;
  1544.          }
  1545.          else
  1546.          {
  1547.             cmax = lastColMax;
  1548.             x += cmax + this.cellSpacing;
  1549.          }
  1550.          con._x = x + offset;
  1551.          con._y = y + voffset;
  1552.          if(this.borderSize > 0)
  1553.          {
  1554.             this.borderClip.lineStyle(this.borderSize,10066329,100);
  1555.             this.borderClip.drawRect(x,y,cwid,rows[r].maxCellDims.height);
  1556.          }
  1557.          lastColMax = cwid;
  1558.          c++;
  1559.       }
  1560.       r++;
  1561.    }
  1562.    this._recalcHeights();
  1563. };
  1564. TableClass.prototype._resizeTextfield = function(oIns, w, h)
  1565. {
  1566.    var txt = oIns.content;
  1567.    if(txt._width > w)
  1568.    {
  1569.       txt.wordWrap = true;
  1570.       txt._width = w;
  1571.       txt._width = Math.round(txt._width);
  1572.       trace("text width: " + txt.textWidth);
  1573.       if(this.reduceTextFields)
  1574.       {
  1575.          var h = txt._height;
  1576.          var w = txt._width;
  1577.          var old_w = 0;
  1578.          var txtWidth = txt.textWidth;
  1579.          var i = w;
  1580.          while(h == txt._height)
  1581.          {
  1582.             if(i <= 0)
  1583.             {
  1584.                break;
  1585.             }
  1586.             if(txt.textWidth < txtWidth)
  1587.             {
  1588.                break;
  1589.             }
  1590.             txt._width--;
  1591.             i--;
  1592.          }
  1593.          txt._width = txt._width + 1;
  1594.       }
  1595.    }
  1596.    oIns._width = txt._width;
  1597. };
  1598. TableClass.prototype._recalcHeights = function()
  1599. {
  1600.    var rows = this.rows;
  1601.    var rc = rows.length;
  1602.    var cc;
  1603.    var cols;
  1604.    var cell;
  1605.    this.height = 0;
  1606.    var r = 0;
  1607.    while(r < rc)
  1608.    {
  1609.       cols = rows[r].cells;
  1610.       cc = cols.length;
  1611.       var c = 0;
  1612.       while(c < cc)
  1613.       {
  1614.          cell = cols[c];
  1615.          rows[r]._checkMaxCellDims(cell);
  1616.          this.height += rows[r].maxCellDims.height;
  1617.          c++;
  1618.       }
  1619.       r++;
  1620.    }
  1621. };
  1622. TableClass.prototype._findLargestColumn = function()
  1623. {
  1624.    var largestId;
  1625.    var largest;
  1626.    var cmaxs = this.colWidthMaxs;
  1627.    var i = 0;
  1628.    while(i < cmaxs.length)
  1629.    {
  1630.       trace("finding largest: " + cmaxs[i]);
  1631.       if(largest < cmaxs[i])
  1632.       {
  1633.          largest = cmaxs[i];
  1634.          largestId = i;
  1635.       }
  1636.       i++;
  1637.    }
  1638.    return largestId;
  1639. };
  1640. TableClass.prototype._recalcDimensions = function(newWidth)
  1641. {
  1642.    var cw = this._getTableWidth();
  1643.    if(newWidth > cw)
  1644.    {
  1645.       return undefined;
  1646.    }
  1647.    trace("\n\n----");
  1648.    trace("TableClass.prototype._recalcDimensions:");
  1649.    trace("current width: " + cw + ", new width: " + newWidth);
  1650.    delete this.alteredColumns;
  1651.    this.alteredColumns = {};
  1652.    this._resizeTableR(cw,newWidth);
  1653.    var addback = newWidth - this._getTableWidth();
  1654.    var cmaxs = this.colWidthMaxs;
  1655.    var prc;
  1656.    var cmax = 0;
  1657.    var acc = 0;
  1658.    for(var nm in this.alteredColumns)
  1659.    {
  1660.       trace("ALTERED COLUMNS: " + nm);
  1661.       if(!isNaN(nm))
  1662.       {
  1663.          acc++;
  1664.       }
  1665.    }
  1666.    for(var colid in this.alteredColumns)
  1667.    {
  1668.       trace("Addback: " + colid + ", " + addback / acc);
  1669.       this.colWidthMaxs[parseInt(colid)] = this.colWidthMaxs[parseInt(colid)] + addback / acc;
  1670.    }
  1671.    if(addback / acc > 0)
  1672.    {
  1673.    }
  1674.    this.width = newWidth;
  1675. };
  1676. TableClass.prototype._resizeTableR = function(lastWidth, targetWidth)
  1677. {
  1678.    if(lastWidth <= targetWidth)
  1679.    {
  1680.       return undefined;
  1681.    }
  1682.    var largest;
  1683.    var largestId = 0;
  1684.    var cmaxs = this.colWidthMaxs;
  1685.    var i = 0;
  1686.    while(i < cmaxs.length)
  1687.    {
  1688.       trace("finding largest: " + cmaxs[i]);
  1689.       if(largest < cmaxs[i])
  1690.       {
  1691.          largest = cmaxs[i];
  1692.          largestId = i;
  1693.       }
  1694.       i++;
  1695.    }
  1696.    var prc = largest / lastWidth;
  1697.    trace("prc: " + prc);
  1698.    var ncw = largest * prc;
  1699.    cmaxs[largestId] = ncw;
  1700.    this.alteredColumns[largestId] = largestId;
  1701.    trace("\n\nAFTER:");
  1702.    trace("new largest: " + ncw);
  1703.    trace("lastWidth: " + lastWidth);
  1704.    trace("largest: " + largest);
  1705.    trace("targetWidth: " + targetWidth);
  1706.    trace("nextWidth: " + (lastWidth - (largest - ncw)));
  1707.    if(prc == 1)
  1708.    {
  1709.       cmax[largestId] = targetWidth;
  1710.       return undefined;
  1711.    }
  1712.    this._resizeTableR(lastWidth - (largest - ncw),targetWidth);
  1713. };
  1714. TableClass.prototype._getTableWidth = function()
  1715. {
  1716.    var width = 0;
  1717.    var lasti = this.colWidthMaxs.length - 1;
  1718.    var i = 0;
  1719.    while(i < this.colWidthMaxs.length)
  1720.    {
  1721.       width += this.colWidthMaxs[i];
  1722.       i++;
  1723.    }
  1724.    return width;
  1725. };
  1726. TableClass.prototype.init = function()
  1727. {
  1728.    this.redraw();
  1729. };
  1730. TableRow = function()
  1731. {
  1732.    this.cells = [];
  1733.    this.maxCellDims = {width:0,height:0};
  1734. };
  1735. TableRow.prototype.addCell = function(cell)
  1736. {
  1737.    this.cells.push(cell);
  1738.    var cc = cell.getContent();
  1739.    var cw = cc == null ? cell.width : cc._width;
  1740.    var ch = cc == null ? cell.height : cc._height;
  1741.    var mw = this.maxCellDims.width;
  1742.    var mh = this.maxCellDims.height;
  1743.    this.maxCellDims.width = cw <= mw ? mw : cw;
  1744.    this.maxCellDims.height = ch <= mh ? mh : ch;
  1745. };
  1746. TableRow.prototype._checkMaxCellDims = function(cell)
  1747. {
  1748.    var cc = cell.getContent();
  1749.    var cw = cc == null ? cell.width : cc._width;
  1750.    var ch = cc == null ? cell.height : cc._height;
  1751.    var mw = this.maxCellDims.width;
  1752.    var mh = this.maxCellDims.height;
  1753.    this.maxCellDims.width = cw <= mw ? mw : cw;
  1754.    this.maxCellDims.height = ch <= mh ? mh : ch;
  1755. };
  1756. TableCell = function(content)
  1757. {
  1758.    this.content = content;
  1759. };
  1760. TableCell.prototype.setContent = function(content)
  1761. {
  1762.    this.content = content;
  1763. };
  1764. TableCell.prototype.getContent = function()
  1765. {
  1766.    return this.content;
  1767. };
  1768. TableCell.prototype.setWidth = function(width, isPercent)
  1769. {
  1770.    this.widthIsPercent = isPercent != null ? true : false;
  1771.    this.width = width;
  1772. };
  1773. TableCell.prototype.setHeight = function(height, isPercent)
  1774. {
  1775.    this.heightIsPercent = isPercent != null ? true : false;
  1776.    this.height = height;
  1777. };
  1778. TableCell.prototype.setHAlign = function(halign)
  1779. {
  1780.    this.halign = halign;
  1781. };
  1782. TableCell.prototype.setVAlign = function(valign)
  1783. {
  1784.    this.valign = valign;
  1785. };
  1786. Image = function(parent, name, depth, url)
  1787. {
  1788.    this.$keepAspect = true;
  1789.    this.load(parent,name,depth,url);
  1790. };
  1791. Image.prototype.setKeepAspectRatio = function(keepAspect)
  1792. {
  1793.    this.$keepAspect = keepAspect;
  1794. };
  1795. Image.prototype.load = function(parent, name, depth, url)
  1796. {
  1797.    if(parent != null && name != null && depth != null && url != null)
  1798.    {
  1799.       if(!this.$mc)
  1800.       {
  1801.       }
  1802.       this.$parent = parent;
  1803.       this.$name = name;
  1804.       this.$depth = depth;
  1805.       this.$url = url;
  1806.       this.$mc = parent.createEmptyMovieClip(name,depth);
  1807.       this.$mc.drawRect(100,100,100,100);
  1808.       this.$mc._width = 100;
  1809.       this.$mc.onLoad = function()
  1810.       {
  1811.          this.onEnterFrame = function()
  1812.          {
  1813.             if(this._height > 0)
  1814.             {
  1815.                onLoad();
  1816.                delete this.onEnterFrame;
  1817.             }
  1818.          };
  1819.       };
  1820.       this.$mc.onLoad.parent = this;
  1821.       this.$mc.loadMovie(url);
  1822.       return this.$mc;
  1823.    }
  1824. };
  1825. Image.prototype.$_onLoad = function()
  1826. {
  1827.    this.onEnterFrame = function()
  1828.    {
  1829.       if(this._height > 0)
  1830.       {
  1831.          this.onLoad.parent.onLoad.call(this.onLoad.parent,arguments);
  1832.          delete this.onEnterFrame;
  1833.       }
  1834.    };
  1835. };
  1836. Image.prototype.getClipInstance = function()
  1837. {
  1838.    return this.$mc;
  1839. };
  1840. Image.prototype.setWidth = function(width)
  1841. {
  1842.    if(this.$keepAspect)
  1843.    {
  1844.       if(this.$aspectRatio == null)
  1845.       {
  1846.          this.$setAspectRatio();
  1847.       }
  1848.       this.$mc._xscale = width / this.$mc._width * 100;
  1849.       this.$mc._yscale = this.$mc._xscale;
  1850.    }
  1851.    else
  1852.    {
  1853.       this.$mc._width = width;
  1854.    }
  1855. };
  1856. Image.prototype.setHeight = function(height)
  1857. {
  1858.    if(this.$keepAspect)
  1859.    {
  1860.       this.$mc._yscale = height / this.$mc._height * 100;
  1861.       this.$mc._xscale = this.$mc._yscale;
  1862.    }
  1863.    else
  1864.    {
  1865.       this.$mc._height = height;
  1866.    }
  1867. };
  1868. Image.prototype.resize = function(width, height)
  1869. {
  1870.    this.setWidth(width);
  1871.    this.setHeight(height);
  1872. };
  1873. Image.prototype.$setAspectRatio = function()
  1874. {
  1875.    this.$aspectRatio = this.$mc._width <= this.$mc._height ? this.$mc._height / this.$mc._width : this.$mc._width / this.$mc._height;
  1876. };
  1877. TextFormat.prototype.cGetTextExtent = function(s, bEmbedFonts, bAccurate)
  1878. {
  1879.    var __CGTE_mc = _root.createEmptyMovieClip("__PMSI_textExtBox__",4013145);
  1880.    __CGTE_mc._visible = false;
  1881.    __CGTE_mc.createTextField("content",1,0,0,0,0);
  1882.    var __CGTE_mc_txt = __CGTE_mc.content;
  1883.    __CGTE_mc_txt.autoSize = true;
  1884.    var __CGTE_marg_h = bAccurate != true ? 0 : __CGTE_mc_txt._height;
  1885.    var __CGTE_marg_v = bAccurate != true ? 0 : __CGTE_mc_txt._width;
  1886.    __CGTE_mc_txt.embedFonts = bEmbedFonts != null ? bEmbedFonts : true;
  1887.    __CGTE_mc_txt.type = "dynamic";
  1888.    __CGTE_mc_txt.selectable = false;
  1889.    __CGTE_mc_txt.text = s;
  1890.    __CGTE_mc_txt.setTextFormat(this);
  1891.    return {width:__CGTE_mc_txt._width - __CGTE_marg_h,height:__CGTE_mc_txt._height - __CGTE_marg_v};
  1892. };
  1893. TextField.prototype.findLines = function(ttf)
  1894. {
  1895.    var mc2 = _root.createEmptyMovieClip("__getLinesBox__",4013146);
  1896.    mc2._visible = false;
  1897.    ttf = ttf != null ? ttf : this.getTextFormat();
  1898.    var lh = ttf.cGetTextExtent("373_<3_4").height;
  1899.    var lines = [];
  1900.    mc2.createTextField("__fio__",1000,0,0,0,0);
  1901.    var f = mc2.__fio__;
  1902.    var als = this.text.split(" ");
  1903.    f._width = this._width;
  1904.    f.embedFonts = this.embedFonts;
  1905.    f.border = this.border;
  1906.    f.type = "dynamic";
  1907.    f.autoSize = true;
  1908.    f.selectable = false;
  1909.    f.wordWrap = true;
  1910.    f.multiline = true;
  1911.    var line = "";
  1912.    var i = 0;
  1913.    while(i < als.length)
  1914.    {
  1915.       f.text += " " + als[i];
  1916.       f.setTextFormat(ttf);
  1917.       if(f._height > lh && line != "")
  1918.       {
  1919.          lines.push(line.trim());
  1920.          f.text = "";
  1921.          line = "";
  1922.          i--;
  1923.       }
  1924.       line = f.text;
  1925.       f.setTextFormat(ttf);
  1926.       i++;
  1927.    }
  1928.    lines.push(f.text.trim());
  1929.    f.removeTextField();
  1930.    this.__lines = lines;
  1931.    return lines;
  1932. };
  1933. TextField.prototype.getLineAt = function(i)
  1934. {
  1935.    if(this.__lines == null)
  1936.    {
  1937.       this.findLines();
  1938.    }
  1939.    return this.__lines[i];
  1940. };
  1941. TextField.prototype.getLineCount = function()
  1942. {
  1943.    if(this.__lines == null)
  1944.    {
  1945.       this.findLines();
  1946.    }
  1947.    return this.__lines.length;
  1948. };
  1949. TextField.prototype.convertToLines = function()
  1950. {
  1951.    if(this.__lines == null)
  1952.    {
  1953.       this.findLines();
  1954.    }
  1955.    this.text = "";
  1956.    var i = 0;
  1957.    while(i < this.__lines.length - 1)
  1958.    {
  1959.       this.text += this.__lines[i] + "\n";
  1960.       i++;
  1961.    }
  1962.    this.text += this.__lines[this.__lines.length - 1];
  1963. };
  1964. TextField.prototype.getLines = function()
  1965. {
  1966.    if(this.__lines == null)
  1967.    {
  1968.       this.findLines();
  1969.    }
  1970.    return this.__lines;
  1971. };
  1972. stop();
  1973. _global.strace = function(s)
  1974. {
  1975. };
  1976. if(_parent)
  1977. {
  1978.    master = _parent;
  1979. }
  1980. else
  1981. {
  1982.    master = this;
  1983. }
  1984. if(master.layoutInfo == null)
  1985. {
  1986.    var layoutInfo = {};
  1987.    layoutInfo.titleTextColor = 3636920;
  1988.    layoutInfo.answerRollOverColor = 16695085;
  1989.    layoutInfo.answerRollOutColor = 3636920;
  1990.    layoutInfo.answerSelectColor = 2309272;
  1991.    layoutInfo.questionTextColor = 2309272;
  1992.    layoutInfo.instTextColor = 2309272;
  1993.    layoutInfo.doAnswerFill = false;
  1994.    layoutInfo.rightSideBuffer = 10;
  1995.    layoutInfo.box = {};
  1996.    layoutInfo.box.x = 260;
  1997.    layoutInfo.box.y = 98;
  1998.    layoutInfo.box.views = [];
  1999.    layoutInfo.box.widthWithBox = 300;
  2000.    layoutInfo.box.heightWithBox = 300;
  2001.    layoutInfo.box.widthWithoutBox = 300;
  2002.    layoutInfo.box.heightWithoutBox = 300;
  2003.    layoutinfo.MAX_WIDTH = 520;
  2004.    layoutInfo.MAX_HEIGHT = 380;
  2005.    layoutInfo.questionIndent = 30;
  2006.    layoutInfo.selectionRadius = 6;
  2007.    layoutInfo.drawSelectionCircle = true;
  2008.    layoutInfo.lineSpacing = 5;
  2009.    layoutInfo.selectionBorderThickness = 1;
  2010.    layoutInfo.instTextFormat = new TextFormat();
  2011.    layoutInfo.instTextFormat.font = "Formata_Normal";
  2012.    layoutInfo.instTextFormat.size = 12;
  2013.    layoutInfo.instTextFormat.color = layoutInfo.instTextColor;
  2014.    layoutInfo.qTextFormat = new TextFormat();
  2015.    layoutInfo.qTextFormat.font = "Formata_Normal";
  2016.    layoutInfo.qTextFormat.size = 12;
  2017.    layoutInfo.qTextFormat.color = layoutInfo.questionTextColor;
  2018.    layoutInfo.qTextFormat.align = "right";
  2019.    layoutInfo.answerTextFormat1 = new TextFormat();
  2020.    layoutInfo.answerTextFormat1.font = "Formata_Normal";
  2021.    layoutInfo.answerTextFormat1.size = 12;
  2022.    layoutInfo.answerTextFormat1.color = layoutInfo.answerRollOutColor;
  2023.    layoutInfo.answerTextFormat2 = new TextFormat();
  2024.    layoutInfo.answerTextFormat2.font = "Formata_Normal";
  2025.    layoutInfo.answerTextFormat2.size = 12;
  2026.    layoutInfo.answerTextFormat2.color = layoutInfo.answerRollOutColor;
  2027.    layoutInfo.titleTextFormat = new TextFormat();
  2028.    layoutInfo.titleTextFormat.font = "TriplexCondSerifBlack";
  2029.    layoutInfo.titleTextFormat.size = 24;
  2030.    layoutInfo.titleTextFormat.color = layoutInfo.titleTextColor;
  2031.    layoutInfo.matchingCircleColor = 16695085;
  2032.    layoutInfo.matchingCircleRadius = 4;
  2033.    layoutInfo.matchingCircleSpacer = 50;
  2034.    layoutInfo.matchingCircleLineThickness = 2;
  2035.    layoutInfo.matchingCircleVertOffset = 4;
  2036. }
  2037. else
  2038. {
  2039.    layoutInfo = master.layoutInfo;
  2040. }
  2041. layoutInfo.qStaticText = new TextFormat();
  2042. layoutInfo.qStaticText.font = "Formata_Normal";
  2043. layoutInfo.qStaticText.size = 12;
  2044. layoutInfo.qStaticText.color = layoutInfo.questionTextColor;
  2045. layoutInfo.qFillText = new TextFormat();
  2046. layoutInfo.qFillText.font = "Formata_Normal";
  2047. layoutInfo.qFillText.size = 12;
  2048. layoutInfo.qFillText.indent = 0;
  2049. layoutInfo.qFillText.align = "center";
  2050. layoutInfo.qFillText.color = layoutInfo.answerRollOutColor;
  2051. layoutInfo.qNumberText = new TextFormat();
  2052. layoutInfo.qNumberText.font = "Formata_Normal";
  2053. layoutInfo.qNumberText.size = 12;
  2054. layoutInfo.qNumberText.color = layoutInfo.questionTextColor;
  2055. TAGS = {};
  2056. TAGS.BLANK_OPEN = "[:blank:]";
  2057. TAGS.BLANK_CLOSE = "[:/blank:]";
  2058. testFile = "activities/data/C3.U6.S2.GR.C5.xml";
  2059. var ai = new ActivityInfo();
  2060. ai._parent = this;
  2061. ai.onLoad = function(success)
  2062. {
  2063.    var i = 0;
  2064.    while(i < this.questions.question.length)
  2065.    {
  2066.       i++;
  2067.    }
  2068.    this._parent.render();
  2069. };
  2070. if(_parent == null)
  2071. {
  2072.    loadActivity(testFile);
  2073. }
  2074. BOX_WIDTH = 270;
  2075. depth = 1000;
  2076. if(_parent)
  2077. {
  2078.    __fio__.removeTextField();
  2079. }
  2080. __fio__._visible = false;
  2081. d;
  2082.